<template>
    <div>
        {{ student.name }}-{{ student.age }}&nbsp;<button @click="updateName">updateName</button>
    </div>
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        let student = ref({
            name: '小明',
            age: 23
        });
        const updateName = () => {
            console.log('修改之前：', student.value.name);
            student.value.name = '小华';
            console.log('修改之后：', student.value.name);
        }
        return { student, updateName }
    }
}
</script>